package com.itplh.modules.ehcache.service.impl;

import com.itplh.modules.mybatisplus.dao.MybatisPlusUserDao;
import com.itplh.modules.mybatisplus.pojo.MybatisPlusUserEntity;
import com.itplh.modules.ehcache.service.EhcacheUserService;
import com.itplh.common.util.PrintUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:
 * @Author: tanpeng
 * @Date: 2019-07-10 22:32
 * @Version: V1.0
 */
@Service
public class EhcacheUserServiceImpl implements EhcacheUserService {

    @Autowired
    private MybatisPlusUserDao userDao;

    @Override
    public MybatisPlusUserEntity findById(Integer id) {
        PrintUtil.loginfo("未命中缓存");
        return userDao.selectById(id);
    }

    @Override
    public int save(MybatisPlusUserEntity user) {
        return userDao.insert(user);
    }

    @Override
    public int delete(Integer id) {
        return userDao.deleteById(id);
    }
}
